/*
 * @Description: 生长记录划分
 */
import zhreq from "@/api/axios";
export default {
  /**
   * @description: 获取表格 *代表必填
   * @param {String/Number} page *
   * @param {String/Number} size *
   */
  getlist(params) {
    // params.entity = params.entity;
    params.entity.farmingTypeNo = sessionStorage.farmingTypeNo;
    params.entity.organizationNo = sessionStorage.organizationNo;
    return zhreq.post("/v3/templateTenant/growthPhase/queryPageByCondition", {
      ...params,
      order: 'ASC',
      sortStr: "sort"
    });
  },
  /**
   * @description:模糊查询 *代表必填
   */
  getqueryList(params) {
    return zhreq.post("/v3/templateTenant/growthPhase/queryByCondition", {
      // auditFlag: 1,
      phaseName: params
    });
  },
  /**
   * @description: 添加
   * @param {Object}  *
   */
  addlist(params) {
    return zhreq.post(`/v3/templateTenant/growthPhase/importByPlantVarietyNo`, {
      ...params,
      organizationNo: sessionStorage.organizationNo
    });
  },
  addGrowthPhase(params) {
    return zhreq.post(`/v3/templateTenant/growthPhase/add`, {
      ...params,
      organizationNo: sessionStorage.organizationNo,
      farmingTypeNo: sessionStorage.farmingTypeNo
    });
  },
  /**
   * @description: 批量删除
   * @param {Object}  *
   */
  dellist(params) {
    return zhreq.post('/v3/templateTenant/growthPhase/delListByNo', {
      'list': params,
      "organizationNo": sessionStorage.organizationNo
    });
  },
  /**
   * @description: 修改
   * @param {Object}  *
   */
  editlist(params) {
    return zhreq.post('/v3/templateTenant/growthPhase/edit', params);
  },
  /**
   * @description: 条件查询
   * @param {Object}  *
   */
  // querybycondition(params) {
  //   return zhreq.post('/v3/templateTenant/growthPhase/queryByCondition', {
  //     ...params
  //   });
  // },
  // 根据品种获取
  querybycondition(params) {
    return zhreq.post('/v3/templateTenant/growthPhase/queryByPlantVarietyNo', {
      ...params,
      organizationNo: sessionStorage.organizationNo
    });
  },
  /**
   * @description: 主键查询图片
   * @param {Object}  *
   */
  getimage(pictureId) {
    return zhreq.get(`/v3/templateTenant/phasePicture/queryByNo?no=${pictureId}&organizationNo=${sessionStorage.organizationNo}`);
  },
  /**
   * @description: 保存排序
   * @param {Object}  *
   */
  savesort(params) {
    return zhreq.post("/growthPhase/sort",
      {
        growthPhaseList: params
      }
    );
  },
  /**
   * @description: 获取生长阶段列表
   */
  getPublicGrowthPhaseList() {
    return zhreq.post('/v3/category/growthPhase/queryByCondition', {})
  },

  // 根据类别获取品种
  getPlantVariety(params) {
    return zhreq.post('/v3/templateTenant/plantVariety/queryByCondition', {
      ...params,
      organizationNo: sessionStorage.organizationNo,
      farmingTypeNo: sessionStorage.farmingTypeNo
    })
  },

  delPictureByNo(no) {
    return zhreq.get(`/v3/templateTenant/phasePicture/delByNo?no=${no}&organizationNo=${sessionStorage.organizationNo}`);
  }
};
